/**
 * 
 */
package com.geezdata.cps.ttk.core.command;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.geezdata.cps.base.response.BaseResponse;
import com.geezdata.cps.base.utils.BeanUtil;
import com.geezdata.cps.cqrs.command.Command;
import com.geezdata.cps.ttk.common.request.UpdateSharerAlipayRequest;
import com.geezdata.cps.ttk.common.response.UpdateSharerAlipayResult;
import com.geezdata.cps.ttk.domain.domain.Sharer;
import com.geezdata.cps.ttk.mapper.mapper.SharerMapper;

/**
 * @author sszheng
 * @date 创建时间：2018年11月2日 上午11:09:09
 *
 */
@Service
public class UpdateSharerAlipayCommand implements Command<UpdateSharerAlipayRequest, UpdateSharerAlipayResult>{
	@Autowired
	private SharerMapper sharerMapper;
	
	@Override
	@Transactional
	public BaseResponse<UpdateSharerAlipayResult> execute(UpdateSharerAlipayRequest request) {
		Sharer sharer = BeanUtil.convert(request, Sharer.class);
		sharer.setUpdatedAt(new Date());
		
		sharerMapper.updateSharerAlipayByOpenId(sharer);
		return BaseResponse.success(null);
	}
}
